import os


def get_icons():
    icons = {'Dark': dict(), 'Light': {}}

    folders = {'Dark': '/usr/share/icons/breeze-dark', 'Light': '/usr/share/icons/breeze'}
    for theme in folders:
        for dir in os.listdir(folders[theme]):
            if os.path.isdir(os.path.join(folders[theme], dir)):
                icons[theme][os.path.join(folders[theme], dir)] = dict()

    sizes = ('256', '128', '64', '32', '24', '22', '16')
    for theme in icons:
        for folder in icons[theme]:
            for size in sizes:
                if os.path.isdir(f'{folder}/{size}') and icons[theme][folder] == {}:
                    svgs = [file for file in os.listdir(f'{folder}/{size}') if file.endswith('.svg')]
                    if len(svgs) >= 8:
                        icons[theme][folder] = [f'/{size}/{svg}' for svg in svgs]
                        break

    for theme in ('Dark', 'Light'):
        folders = icons[theme].keys()
        to_pop = []
        for folder in folders:
            if icons[theme][folder] == {}:
                to_pop.append(folder)
        for folder in to_pop:
            icons[theme].pop(folder)


    return icons
    # res = {'Dark': [], 'Light': []}
    # for theme in icons:
    #     for folder in icons[theme]:
    #         for file in icons[theme][folder]:
    #             res[theme].append(folder + file)
    # return res
